<template>
  <div class="MenuTree">
    <template v-for="item in menuData">
      <el-submenu :key="item.index" :index="item.index" v-if="item.children">
        <template slot="title">
          <i :class="item.icon"></i>
          <span slot="title">{{ item.name }}</span>
        </template>
        <menu-tree :menuData="item.children"></menu-tree>
      </el-submenu>
      <el-menu-item :key="item.index" :index="item.index" v-else>
        <i :class="item.icon"></i>
        <span slot="title">{{ item.name }}</span>
      </el-menu-item>
    </template>
  </div>
</template>

<script>
export default {
  props: ['menuData'],
  name: 'MenuTree'
}
</script>
